home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 5 / Apprentice-Release5.iso / Demos / Bowers Development / AppMaker 2.0b5 / Examples / Procedural / AMReminder / Globals.c < prev    next >
Encoding:
C/C++ Source or Header  |  1996-03-19  |  1.4 KB  |  79 lines  |  [TEXT/MMCC]

  1. /* Globals.c */
  2. /* Created 01/01/95 12:01 PM by AppMaker */
  3.  
  4. #include <Types.h>
  5. #include <Quickdraw.h>
  6. #include <Controls.h>
  7. #include <Dialogs.h>
  8. #include <Events.h>
  9. #include <Lists.h>
  10. #include <Menus.h>
  11. #include <TextEdit.h>
  12. #include "Globals.h"
  13.  
  14. /*Standard vars:*/
  15. Boolean            quittingTime;
  16. EventRecord        curEvent;
  17. WindowPtr        curWindow;
  18. WinInfoPtr        cur;
  19. Boolean            inBackground;
  20. SysConfigRec    sysConfig;
  21.  
  22. WinInfoRec        noCur;
  23.  
  24. /*----------*/
  25. void InitGlobals (void)
  26. {
  27.     curWindow = nil;
  28.     noCur.text = nil;
  29.     noCur.vScroll = nil;
  30.     noCur.hScroll = nil;
  31.     noCur.fileNum = 0;
  32.     noCur.dirty = false;
  33.     noCur.windowKind = noWindow;
  34.  
  35.     cur = &noCur;
  36. } /*InitGlobals*/
  37.  
  38. /*----------*/
  39. void SetInfo (WindowPtr        window)
  40. {
  41.     WinInfoPtr        infoPtr;
  42.  
  43.     if (window != curWindow) {
  44.         curWindow = window;
  45.         if (curWindow != nil) {
  46.             infoPtr = (WinInfoPtr) GetWRefCon (curWindow);
  47.             cur = infoPtr;
  48.         } else {
  49.             cur = &noCur;
  50.         }
  51.     }
  52. } /*SetInfo*/
  53.  
  54. /*----------*/
  55. void SetNewInfo (WindowPtr        window)
  56. {
  57.     WinInfoPtr        infoPtr;
  58.  
  59.     infoPtr = (WinInfoPtr) NewPtr (sizeof (WinInfoRec));
  60.     SetWRefCon (window, (long) infoPtr);
  61.     SetInfo (window);
  62. } /*SetNewInfo*/
  63.  
  64. /*----------*/
  65. void DiscardInfo (WindowPtr        window)
  66. {
  67.     WinInfoPtr        infoPtr;
  68.  
  69.     if (window == curWindow) {
  70.         SetInfo (nil);
  71.     }
  72.     infoPtr = (WinInfoPtr) GetWRefCon (window);
  73.     DisposPtr ((Ptr) infoPtr);
  74.     HideWindow (window);
  75.     DisposeWindow (window);
  76. } /*DiscardInfo*/
  77.  
  78. /* Globals */
  79.